package com.lh.scheduled;

import com.lh.controller.StatisticsDailyController;
import com.lh.service.IStatisticsDailyService;
import com.lh.utils.DateUtil;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author YMS
 * @date 2021/6/9
 */
@Component
public class ScheduledTask {

    @Resource
    private IStatisticsDailyService statisticsDailyService;

    @Scheduled(cron = "0 0 1 * * ? ")
    public void task1(){
        statisticsDailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(), -1)));
    }
}
